package com.block.test.service.impl;

import cn.hutool.core.util.PhoneUtil;
import com.alibaba.fastjson.JSONObject;
import com.block.common.bean.SessionBean;
import com.block.common.constant.AppRspCodeConstant;
import com.block.common.model.vo.ResultInfoVO;
import com.block.common.vo.ResponseVo;
import com.block.test.service.IValidateService;
import org.springframework.stereotype.Service;

@Service
public class SourceRegisterUserValidateService extends IValidateService {

    @Override
    public ResponseVo validate(Object object, JSONObject jsonObject, SessionBean sessionBean) {
        return null;
    }

    @Override
    public ResultInfoVO validate2(Object object, JSONObject jsonObject) {
        String mobile = jsonObject.getString("mobile");
        if (!PhoneUtil.isMobile(mobile)){
            return ResultInfoVO.error(AppRspCodeConstant.PARAM_ERROR, "mobile格式错误，请填写正确的手机号");
        }
        return null;
    }
}
